<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <link rel="stylesheet" type="text/css" href="/css/common.css"/>
  <link rel="stylesheet" type="text/css" href="/css/main.css"/>
  <link rel="stylesheet" type="text/css" href="/css/ui-dialog.css"/>
  <script type="text/javascript" src="/js/libs/modernizr.min.js"></script>
  <script type="text/javascript" src="/js/jquery-1.10.2.min.js"></script>
  <script type="text/javascript" src="/js/dialog-min.js"></script>
  <title>柜员叫号</title>
</head>
<body>
<div style="text-align: center; padding-top:30px;">
<%for(var i = 1; i<=10; i++){%>
<input type="button" class="btn btn4" value="${i }" onclick="call(${i });">&nbsp;
<%}%>
</div>
<div id="error" style="padding-top:30px; display:none;">
  <span id="errorCode"></span><br/>
  <span id="errorMessage"></span>
</div>
<div id="result" style="padding-top:30px;">
</div>

<script language="JavaScript">
  function call(i) {
    $.ajax({
      type: 'GET',
      url: '/queue/nextOrder?window=' + i,
      success: function (data) {
        if(data.errorCode != 0) {
          $('#errorCode')[0].innerHTML = 'errorCode=' + data.errorCode;
          $('#errorMessage')[0].innerHTML = 'errorMessage=' + data.errorMessage;
          $('#error').show();
        } else {
          var html = '请 [' + data.orderNumber + '] 号客户到 <' + i + '>窗口办理业务<br/>';
          html += '<a href="/queue/endOrder?number=' + data.orderNumber + '" class="btn btn4">办理结束</a> ';
          html += '<a href="/queue/ignoreOrder?number=' + data.orderNumber + '" class="btn btn4">跳过</a> ';
          $('#result')[0].innerHTML = html;
        }
      }
    });
  }
</script>
</body>
</html>